const headImg = require("@/assets/img/userImg.f8bbec5e.png");
export default {
    namespaced: true,
    state: {
        nickName: "游客",
        headImg,
        coin: 0,
        cartTotal: 0,
    },
    mutations: {
        updateUserInfo(state, payload) {
            state.nickName = payload.nickName;
            state.headImg = payload.headImg;
            state.coin = payload.coin;
            state.cartTotal = payload.cartTotal;
        },
        initialized(state) {
            state.nickName = "游客";
            state.headImg = headImg
            state.coin = 0;
            state.cartTotal = 0;
        },
        cartchange(state, payload) {
            state.cartTotal = payload.cartTotal == undefined ? 0 : payload.cartTotal;
            // payload.cartTotal == undefined ? 0 :
        }
    }
}